<template>
    <div class="login-wrapper">
        <div class="custom-topHr"></div>

        <div class="logo-box">
            <img class="logo" src="@/assets/images/logo1.png">
        </div>
        <div class="login-box">
            <customForm :type="type"/>

            <div class="submit-box">
                <button class="submit-btn" @click="login">提 交</button>

                <!-- <a class="msg-login" href="#">短信验证登录</a> -->

                <p class="privacy-txt">
                    <span>登录即代表已经并同意</span>
                    <a href="#">《还美医疗整形隐私政策》</a>
                </p>
            </div>
        </div>
    </div>
</template>

<script type="text/ecmascript-6">
    import customForm from "./form";
    import constant from "@/utils/constant.js";
    // 引用API文件
    import http from "@/utils/http.js";

    export default {
        name: "login",
        data() {
            return {
                type: "resetpassword"
            };
        },
        components: {
            customForm
        },
        methods: {
            login() {
                let mobile = this.$route.query.mobile;
                let sms_code = this.$route.query.sms_code;
                let passwordCom = this.$store.state.loginform.passwordCom;

                if (passwordCom == "") {
                    this.$message({
                        message: '请填写密码',
                        type: 'warning'
                    });
                } else {
                    http.post(this, {
                        url: "ucenter/forgetpassword",
                        data: {
                            mobile: mobile,
                            code: sms_code,
                            password:passwordCom
                        },
                        dataType: "json",
                        success: function(data) {
                            console.log("登录:", data);
                            if (data.status == 1) {
                                this.$message.success('设置密码成功')
                            } else {
                                this.$message.error(data.info);
                            }
                        }
                    });
                }
            }
        }
    };
</script>

<style scoped lang="scss">
</style>
